home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
OOPS
/
OBJECTA
/
OBJECTA.DOC
next >
Wrap
Text File
|
1989-07-07
|
2KB
|
73 lines
OBJECTA
A TP 5.5 OOP UNIT
Rob Rosenberger CIS: 74017,1344
Barn Owl Software VOX: (618) 632-7345
P.O. Box #74 BBS: (618) 398-5703
O'Fallon, IL 62269 HST: (618) 398-2305
This Turbo Pascal 5.5 unit builds on the OBJECTS.PAS file on
disk three of the TP package. The Objects unit provides some
excellent linked-list capabilities, but it doesn't allow arbi-
trary placement of a node on the list. The OBJECTA unit offers a
decendent, LinkList, which provides two methods: LinkList.Before,
to place a node just before some other node in the list, and
LinkList.After, to place a node just after some other node in the
list.
LinkList.Init and LinkList.Done are included because the TP
5.5 OOP guide recommends these common procedures. The List
ancestor calls them Clear and Delete, respectively, which I found
extremely odd since Borland is the one calling for a standard set
of method identifiers....
Version 1.00: released to the public domain on 8 July 1989.
TYPE
LinkList
= OBJECT(List)
PROCEDURE Init;
PROCEDURE Before(TheNode : NodePtr;
BeforeNode : NodePtr);
PROCEDURE After (TheNode : NodePtr;
AfterNode : NodePtr);
FUNCTION Total(TheNode : NodePtr) : LONGINT;
PROCEDURE Done; VIRTUAL
END;
PROCEDURE LinkList.Init;
This procedure initializes the LinkList.
PROCEDURE LinkList.Before(TheNode : NodePtr;
BeforeNode : NodePtr);
Places TheNode in the LinkList just before BeforeNode.
PROCEDURE LinkList.After(TheNode : NodePtr;
AfterNode : NodePtr);
Places TheNode in the LinkList just after AfterNode.
FUNCTION LinkList.Total(TheNode : NodePtr) : LONGINT;
This function returns a number corresponding to the number
of nodes on the LinkList. It starts counting from TheNode^.
Therefore, to get a total count of all nodes on the LinkList, use
LinkListVar.Total(LinkListVar.First). (Remember, we inherit the
"First" function due to OOP.)
PROCEDURE LinkList.Done;
This procedure deletes all nodes from the list.